//
//  VipCardReportSectionHeadView.m
//  fitnessmanage
//
//  Created by wujian on 2018/1/2.
//  Copyright © 2018年 zongquankeji. All rights reserved.
//

#import "VipCardReportSectionHeadView.h"

@implementation VipCardReportSectionHeadView

-(id)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    
    if (self) {
        
        self.backgroundColor = CSWhiteColor;
        
        /**
         头像，姓名，性别，电话
         */
        UIImageView *icon = [[UIImageView alloc] init];
        icon.layer.cornerRadius = 30;
        icon.clipsToBounds = YES;
        icon.image = PlaceHold;
        [self addSubview:icon];
        self.iconImage = icon;
        
        UILabel *name = [[UILabel alloc] init];
        name.text = @"姓名";
        name.font = MidBigFont;
        name.textColor = CSBlackColor;
        [self addSubview:name];
        self.nameLabel = name;
        
        UIImageView *sex = [[UIImageView alloc] init];
        sex.image = [UIImage imageNamed:@"icon_man"];
        [self addSubview:sex];
        self.sexImage = sex;
        
        UILabel *tel = [[UILabel alloc] init];
        tel.text = @"18179402031";
        tel.font = MidFont;
        tel.textColor = CSColorFromRGB(0x666666);
        [self addSubview:tel];
        self.telLabel = tel;
        
        UIView *lineView3 = [[UIView alloc] init];
        lineView3.backgroundColor = BackGroundColor;
        [self addSubview:lineView3];
        self.linView3 = lineView3;
        
        /**
         当前提成比例
         */
        UILabel *typeLabel1 = [[UILabel alloc] init];
        typeLabel1.font = MidBigFont;
        typeLabel1.textColor = CSBlackColor;
        typeLabel1.textAlignment = NSTextAlignmentCenter;
        typeLabel1.text = @"12";
        [self.linView3 addSubview:typeLabel1];
        self.typeLabel1 = typeLabel1;
        
        /**
         当前提成比例
         */
        UILabel *typeLabel = [[UILabel alloc] init];
        typeLabel.font = MidFont;
        typeLabel.textColor = CSColorFromRGB(0x666666);
        typeLabel.textAlignment = NSTextAlignmentCenter;
        typeLabel.text = @"当前提成比例";
        [self.linView3 addSubview:typeLabel];
        self.typeLabel = typeLabel;
        
        /**
         销售笔数
         */
        UILabel *countLabel1 = [[UILabel alloc] init];
        countLabel1.text = @"22";
        countLabel1.font = MidBigFont;
        countLabel1.textColor = CSColorFromRGB(0x666666);
        countLabel1.textAlignment = NSTextAlignmentCenter;
        [self.linView3 addSubview:countLabel1];
        self.countLabel1 = countLabel1;
        
        /**
         销售笔数
         */
        UILabel *countLabel = [[UILabel alloc] init];
        countLabel.text = @"销售笔数(笔)";
        countLabel.font = MidFont;
        countLabel.textColor = CSColorFromRGB(0x666666);
        countLabel.textAlignment = NSTextAlignmentCenter;
        [self.linView3 addSubview:countLabel];
        self.countLabel = countLabel;
        
        /**
         销售总额
         */
        UILabel *netReceiptLabel1 = [[UILabel alloc] init];
        netReceiptLabel1.text = @"22";
        netReceiptLabel1.font = MidBigFont;
        netReceiptLabel1.textColor = CSColorFromRGB(0x666666);
        netReceiptLabel1.textAlignment = NSTextAlignmentCenter;
        [self.linView3 addSubview:netReceiptLabel1];
        self.netReceiptLabel1 = netReceiptLabel1;
        
        /**
         销售总额
         */
        UILabel *netReceiptLabel = [[UILabel alloc] init];
        netReceiptLabel.text = @"销售总额(元)";
        netReceiptLabel.font = MidFont;
        netReceiptLabel.textColor = CSColorFromRGB(0x666666);
        netReceiptLabel.textAlignment = NSTextAlignmentCenter;
        [self.linView3 addSubview:netReceiptLabel];
        self.netReceiptLabel = netReceiptLabel;
        
        /**
         销售提成(元)
         */
        UILabel *receiveLabel1 = [[UILabel alloc] init];
        receiveLabel1.text = @"22";
        receiveLabel1.font = MidBigFont;
        receiveLabel1.textColor = CSColorFromRGB(0x666666);
        receiveLabel1.textAlignment = NSTextAlignmentCenter;
        [self.linView3 addSubview:receiveLabel1];
        self.receiveLabel1 = receiveLabel1;
        
        /**
         销售提成(元)
         */
        UILabel *receiveLabel = [[UILabel alloc] init];
        receiveLabel.text = @"销售提成(元)";
        receiveLabel.font = MidFont;
        receiveLabel.textColor = CSColorFromRGB(0x666666);
        receiveLabel.textAlignment = NSTextAlignmentCenter;
        [self.linView3 addSubview:receiveLabel];
        self.receiveLabel = receiveLabel;
        
        
        UIView *lineView = [[UIView alloc] init];
        lineView.backgroundColor = BackGroundColor;
        [self addSubview:lineView];
        self.lineView = lineView;
        
        /**
         报表明细
         */
        UIView *lineView1 = [[UIView alloc] init];
        lineView1.backgroundColor = BackGroundColor;
        [self addSubview:lineView1];
        self.lineView1 = lineView1;
        
        UILabel *titleLabel = [[UILabel alloc] init];
        titleLabel.text = @"报表明细";
        titleLabel.font = MidBigFont;
        titleLabel.textColor = CSColorFromRGB(0x666666);
        [self addSubview:titleLabel];
        self.titleLabel = titleLabel;
        
        UIImageView *lineView2 = [[UIImageView alloc] init];
        lineView2.image = [UIImage imageNamed:@"line"];
        [self addSubview:lineView2];
        self.lineView2 = lineView2;
        
        [self setConstraints];
    }
    
    return self;
}

-(void)setConstraints{
    
    [self.lineView mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.width.top.mas_equalTo(self);
        
        make.height.mas_equalTo(10);
    }];
    
    
    
    /**
     头像，姓名，性别，电话
     */
    [self.iconImage mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.mas_equalTo(self);
        
        make.top.mas_equalTo(self).offset(15);
        
        make.width.height.mas_equalTo(60);
        
    }];
    
    [self.nameLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.right.mas_equalTo(self.iconImage.mas_centerX);
        
        make.top.mas_equalTo(self.iconImage.mas_bottom).offset(15);
        
    }];
    
    [self.sexImage mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.iconImage.mas_centerX);
        
        make.centerY.mas_equalTo(self.nameLabel);
        
    }];
    
    [self.telLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.nameLabel.mas_bottom).offset(10);
        
        make.centerX.mas_equalTo(self.iconImage);
        
    }];
    
    [self.linView3 mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.telLabel.mas_bottom).offset(10);
        
        make.left.width.mas_equalTo(self);
        
        make.bottom.mas_equalTo(self.lineView1.mas_top);
        
    }];
    
    /**
     当前提成比例
     */
    [self.typeLabel1 mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.linView3);
        
        make.top.mas_equalTo(self.linView3.mas_top).offset(10);
        
        make.bottom.mas_equalTo(self.typeLabel.mas_top).offset(-10);
    }];
    
    
    [self.typeLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.linView3);
        
        make.top.mas_equalTo(self.typeLabel1.mas_bottom).offset(5);
        
        make.bottom.mas_equalTo(self.linView3).offset(-10);
    }];
    
    
    /**
     销售笔数
     */
    [self.countLabel1 mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.typeLabel1.mas_right);
        
        make.top.height.width.mas_equalTo(self.typeLabel1);
    }];
    
    [self.countLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.typeLabel.mas_right);
        
        make.top.height.width.mas_equalTo(self.typeLabel);
    }];
    
    /**
     销售总额
     */
    
    [self.netReceiptLabel1 mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.countLabel1.mas_right);
        
        make.top.height.width.mas_equalTo(self.typeLabel1);
        
    }];
    
    [self.netReceiptLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.countLabel.mas_right);
        
        make.top.height.width.mas_equalTo(self.typeLabel);
        
    }];
    
    /**
     销售提成
     */
    
    [self.receiveLabel1 mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.netReceiptLabel1.mas_right);
        
        make.top.height.width.mas_equalTo(self.typeLabel1);
        
        make.right.mas_equalTo(self.linView3);
    }];
    
    [self.receiveLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.netReceiptLabel.mas_right);
        
        make.top.height.width.mas_equalTo(self.typeLabel);
        
        make.right.mas_equalTo(self.linView3);
    }];
    
    //横线
    [self.lineView1 mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        
        make.left.width.mas_equalTo(self);
        
        make.height.mas_equalTo(1);
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.mas_equalTo(self);
        
        make.top.mas_equalTo(self.lineView1.mas_bottom).offset(10);
        
        make.bottom.mas_equalTo(self).offset(-10);
        
//        make.height.mas_equalTo(20);
        
    }];
    
    [self.lineView2 mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.center.mas_equalTo(self.titleLabel);
        
        make.height.mas_equalTo(1);
    }];
}

@end
